home *** CD-ROM | disk | FTP | other *** search
/ Micom Basic 1995 October / CD [BM9510].bin / basic / toukou / vb / cup1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-08-15  |  8.3 KB  |  249 lines

  1. VERSION 2.00
  2. Begin Form FrmGAME 
  3.    Caption         =   "
  4.    Height          =   4425
  5.    Icon            =   CUP1.FRX:0000
  6.    Left            =   1020
  7.    LinkTopic       =   "Form2"
  8.    ScaleHeight     =   268
  9.    ScaleMode       =   3  '
  10.    ScaleWidth      =   487
  11.    Top             =   1140
  12.    Width           =   7425
  13.    Begin CommandButton Command2 
  14.       Caption         =   "
  15.       Height          =   495
  16.       Left            =   5520
  17.       TabIndex        =   10
  18.       Top             =   3480
  19.       Visible         =   0   'False
  20.       Width           =   1215
  21.    End
  22.    Begin PictureBox Picture9 
  23.       AutoRedraw      =   -1  'True
  24.       AutoSize        =   -1  'True
  25.       Height          =   750
  26.       Left            =   3000
  27.       Picture         =   CUP1.FRX:0302
  28.       ScaleHeight     =   720
  29.       ScaleWidth      =   3840
  30.       TabIndex        =   9
  31.       Top             =   1800
  32.       Visible         =   0   'False
  33.       Width           =   3870
  34.    End
  35.    Begin PictureBox Picture6 
  36.       AutoRedraw      =   -1  'True
  37.       AutoSize        =   -1  'True
  38.       Height          =   750
  39.       Left            =   3000
  40.       Picture         =   CUP1.FRX:373C
  41.       ScaleHeight     =   720
  42.       ScaleWidth      =   3840
  43.       TabIndex        =   8
  44.       Top             =   1770
  45.       Visible         =   0   'False
  46.       Width           =   3870
  47.    End
  48.    Begin PictureBox Picture5 
  49.       AutoRedraw      =   -1  'True
  50.       AutoSize        =   -1  'True
  51.       Height          =   750
  52.       Left            =   3000
  53.       Picture         =   CUP1.FRX:6B78
  54.       ScaleHeight     =   720
  55.       ScaleWidth      =   3840
  56.       TabIndex        =   7
  57.       Top             =   1770
  58.       Visible         =   0   'False
  59.       Width           =   3870
  60.    End
  61.    Begin PictureBox Picture8 
  62.       AutoRedraw      =   -1  'True
  63.       AutoSize        =   -1  'True
  64.       Height          =   510
  65.       Left            =   3000
  66.       Picture         =   CUP1.FRX:9FB4
  67.       ScaleHeight     =   480
  68.       ScaleWidth      =   480
  69.       TabIndex        =   6
  70.       Top             =   1770
  71.       Visible         =   0   'False
  72.       Width           =   510
  73.    End
  74.    Begin PictureBox Picture7 
  75.       AutoRedraw      =   -1  'True
  76.       AutoSize        =   -1  'True
  77.       Height          =   510
  78.       Left            =   3000
  79.       Picture         =   CUP1.FRX:A7F0
  80.       ScaleHeight     =   480
  81.       ScaleWidth      =   480
  82.       TabIndex        =   5
  83.       Top             =   1770
  84.       Visible         =   0   'False
  85.       Width           =   510
  86.    End
  87.    Begin PictureBox Picture4 
  88.       AutoRedraw      =   -1  'True
  89.       AutoSize        =   -1  'True
  90.       Height          =   3780
  91.       Left            =   6960
  92.       Picture         =   CUP1.FRX:B02C
  93.       ScaleHeight     =   3750
  94.       ScaleWidth      =   6000
  95.       TabIndex        =   4
  96.       Top             =   3240
  97.       Visible         =   0   'False
  98.       Width           =   6030
  99.    End
  100.    Begin CommandButton Command1 
  101.       Caption         =   "
  102.       Height          =   495
  103.       Left            =   2835
  104.       TabIndex        =   3
  105.       Top             =   3450
  106.       Width           =   1215
  107.    End
  108.    Begin PictureBox Picture3 
  109.       AutoRedraw      =   -1  'True
  110.       AutoSize        =   -1  'True
  111.       Height          =   1950
  112.       Left            =   4275
  113.       Picture         =   CUP1.FRX:23B06
  114.       ScaleHeight     =   1920
  115.       ScaleWidth      =   960
  116.       TabIndex        =   2
  117.       Top             =   825
  118.       Visible         =   0   'False
  119.       Width           =   990
  120.    End
  121.    Begin PictureBox Picture2 
  122.       AutoRedraw      =   -1  'True
  123.       AutoSize        =   -1  'True
  124.       Height          =   1950
  125.       Left            =   2925
  126.       Picture         =   CUP1.FRX:25F40
  127.       ScaleHeight     =   1920
  128.       ScaleWidth      =   960
  129.       TabIndex        =   1
  130.       Top             =   810
  131.       Visible         =   0   'False
  132.       Width           =   990
  133.    End
  134.    Begin PictureBox Picture1 
  135.       AutoRedraw      =   -1  'True
  136.       Height          =   3750
  137.       Left            =   60
  138.       ScaleHeight     =   3720
  139.       ScaleWidth      =   6870
  140.       TabIndex        =   0
  141.       Top             =   105
  142.       Visible         =   0   'False
  143.       Width           =   6900
  144.    End
  145. Declare Function bitblt% Lib "GDI" (ByVal hdestdc%, ByVal x%, ByVal y%, ByVal nwidth%, ByVal nheight%, ByVal hsrcdc%, ByVal xsrc%, ByVal ysrc%, ByVal dwrop&)
  146. Const srccopy = &HCC0020
  147. Const srcinvert = &H660046
  148. Const srcand = &H8800C6
  149. Sub Command1_Click ()
  150.     command1.Visible = False
  151.     mode = 1
  152.     screen.MousePointer = 11
  153.     For i = 1 To 20
  154.         kaiten
  155.     Next i
  156.     screen.MousePointer = 1
  157.     ret = bitblt(hDC, 80, 210, picture9.Width, picture9.Height, picture9.hDC, 0, 0, srccopy)
  158. End Sub
  159. Sub Command2_Click ()
  160.     mode = 0
  161.     syoki
  162.     command2.Visible = False
  163. End Sub
  164. Sub form_load ()
  165.         
  166.         mypath = CurDir$
  167.         
  168.         'mypath = "e:\yama\vb_prog\atekko\"
  169.         
  170.         If Right$(mypath, 1) <> "\" Then mypath = mypath + "\"
  171.         'picture2.picture = LoadPicture(mypath + "cup2.bmp")
  172.         'picture3.picture = LoadPicture(mypath + "cup2m.bmp")
  173.         'picture4.picture = LoadPicture(mypath + "haike1.bmp")
  174.         'picture7.picture = LoadPicture(mypath + "maru1.bmp")
  175.         'picture8.picture = LoadPicture(mypath + "maru1m.bmp")
  176.         'picture5.picture = LoadPicture(mypath + "moji1.bmp")
  177.         'picture6.picture = LoadPicture(mypath + "moji2.bmp")
  178.         'picture9.picture = LoadPicture(mypath + "moji3.bmp")
  179.         Randomize
  180.         speed = 20
  181.         syoki
  182. End Sub
  183. Sub Form_MouseDown (Button As Integer, Shift As Integer, x As Single, y As Single)
  184.     If mode = 1 Then
  185.         For i = 0 To 3
  186.             If Abs(x - cx(i) - 16) < 31 And Abs(y - cy(i) - 32) < 63 Then hantei (i): i = 3
  187.         Next i
  188.     End If
  189. End Sub
  190. Sub Form_Paint ()
  191.     If mode = 0 Then
  192.         cy(ball) = 18
  193.         hyouji
  194.         ret = bitblt(hDC, cx(ball) + 16, 130, picture7.Width, picture7.Height, picture8.hDC, 0, 0, srcand)
  195.         ret = bitblt(hDC, cx(ball) + 16, 130, picture7.Width, picture7.Height, picture7.hDC, 0, 0, srcinvert)
  196.         cy(ball) = 50
  197.     End If
  198. End Sub
  199. Sub hantei (Index)
  200.     mode = 2
  201.     cy(Index) = 18
  202.     hyouji
  203.     If cup(Index) <> 0 Then
  204.         ret = bitblt(hDC, cx(Index) + 16, 130, picture7.Width, picture7.Height, picture8.hDC, 0, 0, srcand)
  205.         ret = bitblt(hDC, cx(Index) + 16, 130, picture7.Width, picture7.Height, picture7.hDC, 0, 0, srcinvert)
  206.         ret = bitblt(hDC, 80, 210, picture5.Width, picture5.Height, picture5.hDC, 0, 0, srccopy)
  207.         speed = speed + 5
  208.     Else
  209.         ret = bitblt(hDC, 80, 210, picture6.Width, picture6.Height, picture6.hDC, 0, 0, srccopy)
  210.         speed = 20
  211.     End If
  212.     command2.Visible = True
  213. End Sub
  214. Sub hyouji ()
  215.     ret = bitblt(picture1.hDC, 25, 20, picture4.Width, picture4.Height, picture4.hDC, 0, 0, srccopy)
  216.     For i = 0 To 3
  217.         ret = bitblt(picture1.hDC, cx(i), cy(i), picture2.Width, picture2.Height, picture3.hDC, 0, 0, srcand)
  218.         ret = bitblt(picture1.hDC, cx(i), cy(i), picture2.Width, picture2.Height, picture2.hDC, 0, 0, srcinvert)
  219.     Next i
  220.     ret = bitblt(hDC, 0, 0, picture1.Width, picture1.Height, picture1.hDC, 0, 0, srccopy)
  221. End Sub
  222. Sub kaiten ()
  223.      Dim x1, y1, x2, y2 As Integer
  224.     c1 = Int(Rnd(1) * 4): c2 = (c1 + Int(Rnd(1) * 3 + 1)) And 3
  225.     If c1 > c2 Then temp = c1: c1 = c2: c2 = temp
  226.     x1 = cx(c1)
  227.     x2 = cx(c2)
  228.     y1 = cy(c1)
  229.     y2 = cy(c2)
  230.     sa = Abs(cx(c2) - cx(c1))
  231.     For i = 0 To 100 Step speed
  232.         cx(c1) = x1 + i * sa \ 100: cx(c2) = x2 - i * sa \ 100: a = Sin(i / 100 * 3.14) * 20: cy(c1) = 50 - a: cy(c2) = 50 + a
  233.         hyouji
  234.     Next i
  235.     cx(c1) = c1 * 100 + 50: cx(c2) = c2 * 100 + 50: cy(c1) = 50: cy(c2) = 50
  236.     hyouji
  237.     temp = cup(c1): cup(c1) = cup(c2): cup(c2) = temp
  238. End Sub
  239. Sub syoki ()
  240.         Cls
  241.         For i = 0 To 3
  242.             cx(i) = 100 * i + 50
  243.             cy(i) = 50
  244.             cup(i) = 0
  245.         Next i
  246.         ball = Int(Rnd(1) * 4): cup(ball) = 1
  247.         command1.Visible = True
  248. End Sub
  249.